package com.licw.mapper;

import com.github.pagehelper.Page;
import com.licw.annotation.AutoFill;
import com.licw.dto.SetmealPageQueryDTO;
import com.licw.entity.Setmeal;
import com.licw.enumeration.OperationType;
import com.licw.vo.DishItemVO;
import com.licw.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {

    /**
     * 新增套餐
     */
    @AutoFill(OperationType.INSERT)
    void insert(Setmeal setmeal);

    /**
     * 根据分类id查询套餐的数量
     */
    @Select("select count(id) from drabbit_take_out.setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    /**
     * 根据id查询套餐
     */
    SetmealVO selectById(Long id);

    /**
     * 更新套餐信息
     */
    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    /**
     * 分页查询套餐
     */
    Page<SetmealVO> pageSelect(SetmealPageQueryDTO setmealPageQueryDTO);

    /**
     * 批量删除套餐
     */
    void deleteBatchByIds(List<Long> ids);

    /**
     * 根据id查询套餐
     */
    Setmeal getById(Long id);

    /**
     * 动态条件查询套餐
     */
    List<Setmeal> list(Setmeal setmeal);

    /**
     * 根据套餐id查询菜品选项
     */
    List<DishItemVO> getDishItemBySetmealId(Long setmealId);
}